package com.zhang.shopping.controller;

import com.zhang.shopping.entity.District;
import com.zhang.shopping.service.IDistrictService;
import com.zhang.shopping.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("districts")
@RestController
public class DistrictController extends BaseController {
	@Autowired
	private IDistrictService districtService;

	@GetMapping({"", "/"})
	public JsonResult<List<District>> getByParent(String parent) {
		List<District> data = districtService.getByParent(parent);
		return new JsonResult<>(OK, data);
	}
	
}